<template>
  <div class="header">
    <!-- logo -->
    <!-- <h1>xxx后台管理系统</h1> -->
    <span v-if="$store.state.userInfo.username">{{$store.state.userInfo.username}}</span>
    <button v-if="$store.state.userInfo.username" @click="logout">退出登录</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      
    };
  },
  created() {
    
  },
  methods: {
    logout() {
        this.$store.commit('logout');
        this.$router.push('/login')
    }
  },
};
</script>

<style>
</style>